<template>
  <div>
    <p>
      数量：<input type="text" v-model.number="count" /> <br /><br />
      价格：<input type="text" v-model.number="price" /> <br /><br />
      总价：{{ (this.count * this.price) | handleSum }}
    </p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      count: 3,
      price: 10,
    };
  },
  computed: {
    sum() {
      return this.count * this.price;
    },
  },
  filters: {
    handleSum(val) {
      console.log(val);
      return "$" + val;
    },
  },
};
</script>

<style scoped>
</style>
